allow passing of multiple possible extensions to GUI (#149)
authortsteven4 <tsteven4@users.noreply.github.com>
Sun, 17 Dec 2017 16:42:57 +0000 (09:42 -0700)
committerGitHub <noreply@github.com>
Sun, 17 Dec 2017 16:42:57 +0000 (09:42 -0700)
The extensions are used by GUI for filtering files to display for both input and output.  The first extension is used by the gui in the output file dialog if a user doesn't supply and extension.

gui/formatload.cc
vecs.cc
xmldoc/formats/gtrnctr1.xml [deleted file]

index 7142f35a184e8bede458be23a7ec0635e4174451..774e3b7c12d02f8534eaeab3858ae4e152e02dae 100644 (file)
@@ -108,7 +108,7 @@ bool FormatLoad::processFormat(Format &format)
                  hfields[1][1] == QChar('w'),  hfields[1][3] == QChar('w'),  hfields[1][5] == QChar('w'),
                  hfields[0] == "file",
                  hfields[0] == "serial",
-                 QStringList() << hfields[3],
+                 hfields[3].split('/'),
                  optionList,
                  optionList2, htmlPage);
   if (htmlPage.length() > 0 && Format::getHtmlBase().length() == 0) {
diff --git a/vecs.cc b/vecs.cc
index 6ecbe5312933ba338acec225940214fad36fed25..2edbe55e082b518f02793178ae5a29bca6786e98 100644 (file)
--- a/vecs.cc
+++ b/vecs.cc
@@ -32,7 +32,7 @@ typedef struct {
   ff_vecs_t* vec;
   const char* name;
   const char* desc;
-  const char* extension;
+  const char* extensions; // list of possible extensions separated by '/', first is output default for GUI.
   const char* parent;
 } vecs_t;
 
@@ -241,13 +241,6 @@ vecs_t vec_list[] = {
     "gdb",
     NULL,
   },
-  {
-    &gtc_vecs,
-    "gtrnctr",
-    "Garmin Training Center (.xml)",
-    "xml",
-    NULL,
-  },
   {
     &mapsend_vecs,
     "mapsend",
@@ -663,8 +656,8 @@ vecs_t vec_list[] = {
   {
     &gtc_vecs,
     "gtrnctr",
-    "Garmin Training Center (.tcx)",
-    "xml",
+    "Garmin Training Center (.tcx/.crs/.hst/.xml)",
+    "tcx/crs/hst/xml",
     NULL,
   },
   {
@@ -1499,7 +1492,7 @@ sort_and_unify_vecs(int* ctp)
     svp[i] = (vecs_t*) xcalloc(1, sizeof** svp);
     svp[i]->name = svec->name;
     svp[i]->vec = (ff_vecs_t*) xmalloc(sizeof(*svp[i]->vec));
-    svp[i]->extension = xcsv_file.extension;
+    svp[i]->extensions = xcsv_file.extension;
     *svp[i]->vec = *vec_list[0].vec; /* Interits xcsv opts */
     /* Reset file type to inherit ff_type from xcsv for everything
      * except the xcsv format itself, which we leave as "internal"
@@ -1722,7 +1715,7 @@ disp_formats(int version)
         disp_v2(vec->vec);
       }
       printf("%s\t%s\t%s%s%s\n", vec->name,
-             vec->extension? vec->extension : "",
+             vec->extensions? vec->extensions : "",
              vec->desc,
              version >= 3 ? "\t" : "",
              version >= 3 ? vec->parent : "");
diff --git a/xmldoc/formats/gtrnctr1.xml b/xmldoc/formats/gtrnctr1.xml
deleted file mode 100644 (file)
index 8b13789..0000000
+++ /dev/null
@@ -1 +0,0 @@
-